﻿<Activity mc:Ignorable="sap sap2010 sads" x:Class="Plumsail.ActionsPack.StringSplit"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mca="clr-namespace:Microsoft.CSharp.Activities;assembly=System.Activities"
 xmlns:p="http://schemas.microsoft.com/workflow/2012/07/xaml/activities"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="SourceString" Type="InArgument(x:String)" />
    <x:Property Name="SplitString" Type="InArgument(x:String)" />
    <x:Property Name="ResultVariable" Type="OutArgument(p:DynamicValue)" />
  </x:Members>
  <sap2010:ExpressionActivityEditor.ExpressionActivityEditor>C#</sap2010:ExpressionActivityEditor.ExpressionActivityEditor>
  <sap2010:WorkflowViewState.IdRef>Plumsail.ActionsPack.StringSplit_1</sap2010:WorkflowViewState.IdRef>
  <TextExpression.NamespacesForImplementation>
    <sco:Collection x:TypeArguments="x:String">
      <x:String>System</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Text</x:String>
      <x:String>Microsoft.Activities</x:String>
    </sco:Collection>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>Microsoft.Activities</AssemblyReference>
      <AssemblyReference>Microsoft.SharePoint.DesignTime.Activities</AssemblyReference>
      <AssemblyReference>PresentationFramework</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System.Drawing</AssemblyReference>
      <AssemblyReference>System.Runtime.Serialization</AssemblyReference>
      <AssemblyReference>System.ServiceModel.Activities</AssemblyReference>
      <AssemblyReference>System.Workflow.ComponentModel</AssemblyReference>
      <AssemblyReference>System.Workflow.Runtime</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>Plumsail.ActionsPack</AssemblyReference>
    </sco:Collection>
  </TextExpression.ReferencesForImplementation>
  <Sequence DisplayName="Split string" sap2010:WorkflowViewState.IdRef="Sequence_1">
    <Sequence.Variables>
      <Variable x:TypeArguments="x:Boolean" Default="True" Name="LoopFlag" />
      <Variable x:TypeArguments="x:Int32" Name="SplitStringIndex" />
      <Variable x:TypeArguments="x:String" Name="CurrentString">
        <Variable.Default>
          <mca:CSharpValue x:TypeArguments="x:String">SourceString</mca:CSharpValue>
        </Variable.Default>
      </Variable>
      <Variable x:TypeArguments="x:Int32" Name="SplitStringLength">
        <Variable.Default>
          <mca:CSharpValue x:TypeArguments="x:Int32">SplitString.Length</mca:CSharpValue>
        </Variable.Default>
      </Variable>
      <Variable x:TypeArguments="x:Int32" Default="0" Name="CollectionIndex" />
      <Variable x:TypeArguments="x:String" Name="CurrentSubstring" />
      <Variable x:TypeArguments="x:Int32" Name="SplitStringEndIndex" />
      <Variable x:TypeArguments="x:String" Name="JSONResult">
        <Variable.Default>
          <Literal x:TypeArguments="x:String" Value="" />
        </Variable.Default>
      </Variable>
    </Sequence.Variables>
    <p:CreateDynamicValue DisplayName="Init result dynamic value" sap2010:WorkflowViewState.IdRef="CreateDynamicValue_1">
      <p:CreateDynamicValue.Result>
        <OutArgument x:TypeArguments="p:DynamicValue">
          <mca:CSharpReference x:TypeArguments="p:DynamicValue">ResultVariable</mca:CSharpReference>
        </OutArgument>
      </p:CreateDynamicValue.Result>
    </p:CreateDynamicValue>
    <Assign DisplayName="Init result JSON variable" sap2010:WorkflowViewState.IdRef="Assign_8">
      <Assign.To>
        <OutArgument x:TypeArguments="x:String">
          <mca:CSharpReference x:TypeArguments="x:String">JSONResult</mca:CSharpReference>
        </OutArgument>
      </Assign.To>
      <Assign.Value>
        <InArgument x:TypeArguments="x:String">
          <mca:CSharpValue x:TypeArguments="x:String">JSONResult + "["</mca:CSharpValue>
        </InArgument>
      </Assign.Value>
    </Assign>
    <DoWhile sap2010:WorkflowViewState.IdRef="DoWhile_1">
      <DoWhile.Condition>
        <mca:CSharpValue x:TypeArguments="x:Boolean">LoopFlag</mca:CSharpValue>
      </DoWhile.Condition>
      <Sequence sap2010:WorkflowViewState.IdRef="Sequence_4">
        <Assign sap2010:WorkflowViewState.IdRef="Assign_1">
          <Assign.To>
            <OutArgument x:TypeArguments="x:Int32">
              <mca:CSharpReference x:TypeArguments="x:Int32">SplitStringIndex</mca:CSharpReference>
            </OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="x:Int32">
              <mca:CSharpValue x:TypeArguments="x:Int32">CurrentString.IndexOf(SplitString)</mca:CSharpValue>
            </InArgument>
          </Assign.Value>
        </Assign>
        <Assign sap2010:WorkflowViewState.IdRef="Assign_2">
          <Assign.To>
            <OutArgument x:TypeArguments="x:Int32">
              <mca:CSharpReference x:TypeArguments="x:Int32">SplitStringEndIndex</mca:CSharpReference>
            </OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="x:Int32">
              <mca:CSharpValue x:TypeArguments="x:Int32">SplitStringIndex + SplitStringLength</mca:CSharpValue>
            </InArgument>
          </Assign.Value>
        </Assign>
        <If DisplayName="If separator found not in the begining of the string" sap2010:WorkflowViewState.IdRef="If_3">
          <If.Condition>
            <InArgument x:TypeArguments="x:Boolean">
              <mca:CSharpValue x:TypeArguments="x:Boolean">SplitStringIndex &gt; 0</mca:CSharpValue>
            </InArgument>
          </If.Condition>
          <If.Then>
            <Sequence sap2010:WorkflowViewState.IdRef="Sequence_5">
              <Assign sap2010:WorkflowViewState.IdRef="Assign_3">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:String">
                    <mca:CSharpReference x:TypeArguments="x:String">CurrentSubstring</mca:CSharpReference>
                  </OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:String">
                    <mca:CSharpValue x:TypeArguments="x:String">CurrentString.Substring(0, SplitStringIndex)</mca:CSharpValue>
                  </InArgument>
                </Assign.Value>
              </Assign>
              <Assign sap2010:WorkflowViewState.IdRef="Assign_10">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:String">
                    <mca:CSharpReference x:TypeArguments="x:String">JSONResult</mca:CSharpReference>
                  </OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:String">
                    <mca:CSharpValue x:TypeArguments="x:String">JSONResult + String.Format("\"{0}\",", CurrentSubstring)</mca:CSharpValue>
                  </InArgument>
                </Assign.Value>
              </Assign>
            </Sequence>
          </If.Then>
        </If>
        <If DisplayName="If separator found" sap2010:WorkflowViewState.IdRef="If_1">
          <If.Condition>
            <InArgument x:TypeArguments="x:Boolean">
              <mca:CSharpValue x:TypeArguments="x:Boolean">SplitStringIndex &gt;= 0</mca:CSharpValue>
            </InArgument>
          </If.Condition>
          <If.Then>
            <Sequence sap2010:WorkflowViewState.IdRef="Sequence_2">
              <Assign sap2010:WorkflowViewState.IdRef="Assign_4">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:String">
                    <mca:CSharpReference x:TypeArguments="x:String">CurrentString</mca:CSharpReference>
                  </OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:String">
                    <mca:CSharpValue x:TypeArguments="x:String">CurrentString.Substring(SplitStringEndIndex, CurrentString.Length - SplitStringEndIndex)</mca:CSharpValue>
                  </InArgument>
                </Assign.Value>
              </Assign>
            </Sequence>
          </If.Then>
        </If>
        <If DisplayName="If separator not found" sap2010:WorkflowViewState.IdRef="If_2">
          <If.Condition>
            <InArgument x:TypeArguments="x:Boolean">
              <mca:CSharpValue x:TypeArguments="x:Boolean">SplitStringIndex &lt; 0</mca:CSharpValue>
            </InArgument>
          </If.Condition>
          <If.Then>
            <Sequence sap2010:WorkflowViewState.IdRef="Sequence_3">
              <If DisplayName="If current string is not empty" sap2010:WorkflowViewState.IdRef="If_4">
                <If.Condition>
                  <InArgument x:TypeArguments="x:Boolean">
                    <mca:CSharpValue x:TypeArguments="x:Boolean">!String.IsNullOrEmpty(CurrentString)</mca:CSharpValue>
                  </InArgument>
                </If.Condition>
                <If.Then>
                  <Sequence sap2010:WorkflowViewState.IdRef="Sequence_6">
                    <Assign sap2010:WorkflowViewState.IdRef="Assign_5">
                      <Assign.To>
                        <OutArgument x:TypeArguments="x:String">
                          <mca:CSharpReference x:TypeArguments="x:String">CurrentSubstring</mca:CSharpReference>
                        </OutArgument>
                      </Assign.To>
                      <Assign.Value>
                        <InArgument x:TypeArguments="x:String">
                          <mca:CSharpValue x:TypeArguments="x:String">CurrentString</mca:CSharpValue>
                        </InArgument>
                      </Assign.Value>
                    </Assign>
                    <Assign sap2010:WorkflowViewState.IdRef="Assign_11">
                      <Assign.To>
                        <OutArgument x:TypeArguments="x:String">
                          <mca:CSharpReference x:TypeArguments="x:String">JSONResult</mca:CSharpReference>
                        </OutArgument>
                      </Assign.To>
                      <Assign.Value>
                        <InArgument x:TypeArguments="x:String">
                          <mca:CSharpValue x:TypeArguments="x:String">JSONResult + String.Format("\"{0}\",", CurrentString)</mca:CSharpValue>
                        </InArgument>
                      </Assign.Value>
                    </Assign>
                  </Sequence>
                </If.Then>
              </If>
              <Assign DisplayName="Set flag to exit loop" sap2010:WorkflowViewState.IdRef="Assign_6">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:Boolean">
                    <mca:CSharpReference x:TypeArguments="x:Boolean">LoopFlag</mca:CSharpReference>
                  </OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:Boolean">False</InArgument>
                </Assign.Value>
              </Assign>
            </Sequence>
          </If.Then>
        </If>
        <Assign DisplayName="Increment index for result JSON" sap2010:WorkflowViewState.IdRef="Assign_7">
          <Assign.To>
            <OutArgument x:TypeArguments="x:Int32">
              <mca:CSharpReference x:TypeArguments="x:Int32">CollectionIndex</mca:CSharpReference>
            </OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="x:Int32">
              <mca:CSharpValue x:TypeArguments="x:Int32">CollectionIndex + 1</mca:CSharpValue>
            </InArgument>
          </Assign.Value>
        </Assign>
      </Sequence>
    </DoWhile>
    <If DisplayName="If json variable has ',' on the end" sap2010:WorkflowViewState.IdRef="If_5">
      <If.Condition>
        <InArgument x:TypeArguments="x:Boolean">
          <mca:CSharpValue x:TypeArguments="x:Boolean">JSONResult.EndsWith(",")</mca:CSharpValue>
        </InArgument>
      </If.Condition>
      <If.Then>
        <Assign sap2010:WorkflowViewState.IdRef="Assign_12">
          <Assign.To>
            <OutArgument x:TypeArguments="x:String">
              <mca:CSharpReference x:TypeArguments="x:String">JSONResult</mca:CSharpReference>
            </OutArgument>
          </Assign.To>
          <Assign.Value>
            <InArgument x:TypeArguments="x:String">
              <mca:CSharpValue x:TypeArguments="x:String">JSONResult.Substring(0, JSONResult.Length - 1)</mca:CSharpValue>
            </InArgument>
          </Assign.Value>
        </Assign>
      </If.Then>
    </If>
    <Assign DisplayName="Set finish bracket" sap2010:WorkflowViewState.IdRef="Assign_9">
      <Assign.To>
        <OutArgument x:TypeArguments="x:String">
          <mca:CSharpReference x:TypeArguments="x:String">JSONResult</mca:CSharpReference>
        </OutArgument>
      </Assign.To>
      <Assign.Value>
        <InArgument x:TypeArguments="x:String">
          <mca:CSharpValue x:TypeArguments="x:String">JSONResult + "]"</mca:CSharpValue>
        </InArgument>
      </Assign.Value>
    </Assign>
    <p:ParseDynamicValue DisplayName="Parse result JSON into dynamic value" sap2010:WorkflowViewState.IdRef="ParseDynamicValue_1">
      <p:ParseDynamicValue.Result>
        <OutArgument x:TypeArguments="p:DynamicValue">
          <mca:CSharpReference x:TypeArguments="p:DynamicValue">ResultVariable</mca:CSharpReference>
        </OutArgument>
      </p:ParseDynamicValue.Result>
      <InArgument x:TypeArguments="x:String">
        <mca:CSharpValue x:TypeArguments="x:String">JSONResult</mca:CSharpValue>
      </InArgument>
    </p:ParseDynamicValue>
    <sads:DebugSymbol.Symbol>d3ZDOlxLaHJpdG9uZW5rb3ZcU291cmNlczIwMTNcV0ZBY3Rpdml0eVBhY2tcUGx1bXNhaWwuQWN0aXZpdHlQYWNrXFNQQWN0aXZpdHlcU3RyaW5nQWN0aW9uc1xTdHJpbmdTcGxpdFxTdHJpbmdTcGxpdC54YW1sQDEDpAIOAgEBMzUzOwIBHDcLN1UCARA8CzxaAgEEPzM/NgIBA0QLRDoCAQJIBU4cAwGqA08FWg4DAZEDWwX3AQ8CAXX4AQWMAgoCAU+NAgWYAg4CATaZAgWiAhsCAR1LC0tlAwGrA1cLV1kDAZ4DUgtSWwMBkgNdCV1QAwGFA18H9gESAgF2+wEL+wFiAgFQ/wEJigISAgFclQILlQJZAgFDkAILkAJbAgE3nAILnAJlAgEqoAIJoAJRAgEeYAlrEgMB7AJsCXcSAwHTAngJmgEOAwGTApsBCbEBDgMB7AGyAQnpAQ4DAZAB6gEJ9QESAgF3hwIPhwJ7AgFpggIPggJfAgFdaA9obgMB+QJjD2NkAwHtAnQPdHADAeACbw9vZwMB1AJ7D3tlAwGUAn8NmAEYAwGgAp4BD54BZgMB7QGiAQ2vARgDAfkBtQEPtQFlAwGRAbkBDecBGAMBnQHyAQ/yAV8DAYQB7QEP7QFjAgF4gAEPiwEYAwG6AowBD5cBGAMBoQKjAQ+uARgDAfoBugEP3AEUAwGsAd0BD+YBGAMBngGIARWIAX8DAccCgwEVgwFrAwG7ApQBFZQBiwEDAa4CjwEVjwFlAwGiAqsBFasBqwEDAYcCpgEVpgFoAwH7Ab0BFb0BeAMBrQHBARPaAR4DAbkB5AE75AFAAwGrAeABFeABZAMBnwHCARXNAR4DAdMBzgEV2QEeAwG6AcoBG8oBZgMB4AHFARvFAXEDAdQB1gEb1gGOAQMBxwHRARvRAWsDAbsB</sads:DebugSymbol.Symbol>
  </Sequence>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="CreateDynamicValue_1" sap:VirtualizedContainerService.HintSize="659,22" />
      <sap2010:ViewStateData Id="Assign_8" sap:VirtualizedContainerService.HintSize="659,62" />
      <sap2010:ViewStateData Id="Assign_1" sap:VirtualizedContainerService.HintSize="611,62" />
      <sap2010:ViewStateData Id="Assign_2" sap:VirtualizedContainerService.HintSize="611,62" />
      <sap2010:ViewStateData Id="Assign_3" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Assign_10" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Sequence_5" sap:VirtualizedContainerService.HintSize="264,288">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="If_3" sap:VirtualizedContainerService.HintSize="611,438" />
      <sap2010:ViewStateData Id="Assign_4" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Sequence_2" sap:VirtualizedContainerService.HintSize="264,186">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="If_1" sap:VirtualizedContainerService.HintSize="611,336" />
      <sap2010:ViewStateData Id="Assign_5" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Assign_11" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Sequence_6" sap:VirtualizedContainerService.HintSize="264,288">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="If_4" sap:VirtualizedContainerService.HintSize="464,438" />
      <sap2010:ViewStateData Id="Assign_6" sap:VirtualizedContainerService.HintSize="464,62" />
      <sap2010:ViewStateData Id="Sequence_3" sap:VirtualizedContainerService.HintSize="486,664">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="If_2" sap:VirtualizedContainerService.HintSize="611,814" />
      <sap2010:ViewStateData Id="Assign_7" sap:VirtualizedContainerService.HintSize="611,62" />
      <sap2010:ViewStateData Id="Sequence_4" sap:VirtualizedContainerService.HintSize="633,2098">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="DoWhile_1" sap:VirtualizedContainerService.HintSize="659,2262" />
      <sap2010:ViewStateData Id="Assign_12" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="If_5" sap:VirtualizedContainerService.HintSize="659,212" />
      <sap2010:ViewStateData Id="Assign_9" sap:VirtualizedContainerService.HintSize="659,62" />
      <sap2010:ViewStateData Id="ParseDynamicValue_1" sap:VirtualizedContainerService.HintSize="659,22" />
      <sap2010:ViewStateData Id="Sequence_1" sap:VirtualizedContainerService.HintSize="681,2966">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="Plumsail.ActionsPack.StringSplit_1" sap:VirtualizedContainerService.HintSize="721,3086" />
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>